/*
               File: PrcCharge
        Description: Prc Charge
             Author: GeneXus C# Generator version 10_2_5-78484
       Generated on: 6/6/2014 9:52:43.34
       Program type: Callable routine
          Main DBMS: sqlserver
*/
using System;
using System.Collections;
using GeneXus.Utils;
using GeneXus.Resources;
using GeneXus.Application;
using GeneXus.Metadata;
using System.Data;
using System.Data.SqlClient;
using GeneXus.Data;
using com.genexus;
using GeneXus.Data.ADO;
using GeneXus.Data.NTier;
using GeneXus.Data.NTier.ADO;
using System.Runtime.Remoting;
using GeneXus.WebControls;
using GeneXus.Http;
using GeneXus.Procedure;
using GeneXus.XML;
using GeneXus.Search;
using GeneXus.Encryption;
using GeneXus.Http.Client;
using System.Threading;
using System.Xml.Serialization;
using System.Data.SqlTypes;
using System.ServiceModel;
using System.Runtime.Serialization;
namespace GeneXus.Programs {
   public class prccharge : GXProcedure
   {
      public prccharge( )
      {
         context = new GxContext(  );
         DataStoreUtil.LoadDataStores( context);
         dsDefault = context.GetDataStore("Default");
         IsMain = true;
         context.SetDefaultTheme("GeneXusXEv2");
      }

      public prccharge( IGxContext context )
      {
         this.context = context;
         IsMain = false;
         dsDefault = context.GetDataStore("Default");
      }

      public void release( )
      {
      }

      public void execute( )
      {
         initialize();
         executePrivate();
      }

      public void executeSubmit( )
      {
         prccharge objprccharge;
         objprccharge = new prccharge();
         objprccharge.context.SetSubmitInitialConfig(context);
         objprccharge.initialize();
         ThreadPool.QueueUserWorkItem( new WaitCallback( executePrivateCatch ),objprccharge);
      }

      void executePrivateCatch( object stateInfo )
      {
         try
         {
            ((prccharge)stateInfo).executePrivate();
         }
         catch ( Exception e )
         {
            GXUtil.SaveToEventLog( "Design", e);
            throw e ;
         }
      }

      void executePrivate( )
      {
         /* GeneXus formulas */
         /* Output device settings */
         /*
            INSERT RECORD ON TABLE TBLParameter

         */
         A51ParameterId = 1;
         A52ParameterDescription = "URL Logo";
         A53ParameterValue = "D:\\Models\\DeMolay\\CSharpModel\\Web\\Resources\\logo.png";
         /* Using cursor P000B2 */
         pr_default.execute(0, new Object[] {A51ParameterId, A52ParameterDescription, A53ParameterValue});
         pr_default.close(0);
         dsDefault.SmartCacheProvider.SetUpdated("TBLParameter") ;
         if ( (pr_default.getStatus(0) == 1) )
         {
            context.Gx_err = 1;
            Gx_emsg = (String)(context.GetMessage( "GXM_noupdate", ""));
         }
         else
         {
            context.Gx_err = 0;
            Gx_emsg = "";
         }
         /* End Insert */
         /*
            INSERT RECORD ON TABLE TBLParameter

         */
         A51ParameterId = 2;
         A52ParameterDescription = "Texto Inicial CIMA";
         A53ParameterValue = "Somos mais do que mil,";
         /* Using cursor P000B3 */
         pr_default.execute(1, new Object[] {A51ParameterId, A52ParameterDescription, A53ParameterValue});
         pr_default.close(1);
         dsDefault.SmartCacheProvider.SetUpdated("TBLParameter") ;
         if ( (pr_default.getStatus(1) == 1) )
         {
            context.Gx_err = 1;
            Gx_emsg = (String)(context.GetMessage( "GXM_noupdate", ""));
         }
         else
         {
            context.Gx_err = 0;
            Gx_emsg = "";
         }
         /* End Insert */
         /*
            INSERT RECORD ON TABLE TBLParameter

         */
         A51ParameterId = 3;
         A52ParameterDescription = "Texto Inicial BAIXO";
         A53ParameterValue = "SOMOS UM!!!";
         /* Using cursor P000B4 */
         pr_default.execute(2, new Object[] {A51ParameterId, A52ParameterDescription, A53ParameterValue});
         pr_default.close(2);
         dsDefault.SmartCacheProvider.SetUpdated("TBLParameter") ;
         if ( (pr_default.getStatus(2) == 1) )
         {
            context.Gx_err = 1;
            Gx_emsg = (String)(context.GetMessage( "GXM_noupdate", ""));
         }
         else
         {
            context.Gx_err = 0;
            Gx_emsg = "";
         }
         /* End Insert */
         /*
            INSERT RECORD ON TABLE TBLParameter

         */
         A51ParameterId = 4;
         A52ParameterDescription = "Rodape";
         A53ParameterValue = "Gabinete Estadual da Ordem DeMolay - 2014/2015";
         /* Using cursor P000B5 */
         pr_default.execute(3, new Object[] {A51ParameterId, A52ParameterDescription, A53ParameterValue});
         pr_default.close(3);
         dsDefault.SmartCacheProvider.SetUpdated("TBLParameter") ;
         if ( (pr_default.getStatus(3) == 1) )
         {
            context.Gx_err = 1;
            Gx_emsg = (String)(context.GetMessage( "GXM_noupdate", ""));
         }
         else
         {
            context.Gx_err = 0;
            Gx_emsg = "";
         }
         /* End Insert */
         this.cleanup();
      }

      public void cleanup( )
      {
         context.CommitDataStores("PrcCharge");
         CloseOpenCursors();
         if ( IsMain )
         {
            context.CloseConnections() ;
         }
         exitApplication();
      }

      protected void CloseOpenCursors( )
      {
      }

      public override void initialize( )
      {
         A52ParameterDescription = "";
         A53ParameterValue = "";
         Gx_emsg = "";
         pr_default = new DataStoreProvider(context, new GeneXus.Programs.prccharge__default(),
            new Object[][] {
                new Object[] {
               }
               , new Object[] {
               }
               , new Object[] {
               }
               , new Object[] {
               }
            }
         );
         /* GeneXus formulas. */
         context.Gx_err = 0;
      }

      private int GX_INS8 ;
      private long A51ParameterId ;
      private String Gx_emsg ;
      private String A53ParameterValue ;
      private String A52ParameterDescription ;
      private IGxDataStore dsDefault ;
      private IDataStoreProvider pr_default ;
   }

   public class prccharge__default : DataStoreHelperBase, IDataStoreHelper
   {
      public ICursor[] getCursors( )
      {
         cursorDefinitions();
         return new Cursor[] {
          new UpdateCursor(def[0])
         ,new UpdateCursor(def[1])
         ,new UpdateCursor(def[2])
         ,new UpdateCursor(def[3])
       };
    }

    private static CursorDef[] def;
    private void cursorDefinitions( )
    {
       if ( def == null )
       {
          Object[] prmP000B2 ;
          prmP000B2 = new Object[] {
          new Object[] {"@ParameterId",SqlDbType.Decimal,15,0} ,
          new Object[] {"@ParameterDescription",SqlDbType.VarChar,1000,0} ,
          new Object[] {"@ParameterValue",SqlDbType.VarChar,2097152,0}
          } ;
          Object[] prmP000B3 ;
          prmP000B3 = new Object[] {
          new Object[] {"@ParameterId",SqlDbType.Decimal,15,0} ,
          new Object[] {"@ParameterDescription",SqlDbType.VarChar,1000,0} ,
          new Object[] {"@ParameterValue",SqlDbType.VarChar,2097152,0}
          } ;
          Object[] prmP000B4 ;
          prmP000B4 = new Object[] {
          new Object[] {"@ParameterId",SqlDbType.Decimal,15,0} ,
          new Object[] {"@ParameterDescription",SqlDbType.VarChar,1000,0} ,
          new Object[] {"@ParameterValue",SqlDbType.VarChar,2097152,0}
          } ;
          Object[] prmP000B5 ;
          prmP000B5 = new Object[] {
          new Object[] {"@ParameterId",SqlDbType.Decimal,15,0} ,
          new Object[] {"@ParameterDescription",SqlDbType.VarChar,1000,0} ,
          new Object[] {"@ParameterValue",SqlDbType.VarChar,2097152,0}
          } ;
          def= new CursorDef[] {
              new CursorDef("P000B2", "INSERT INTO [TBLParameter] ([ParameterId], [ParameterDescription], [ParameterValue]) VALUES (@ParameterId, @ParameterDescription, @ParameterValue)", GxErrorMask.GX_NOMASK,prmP000B2)
             ,new CursorDef("P000B3", "INSERT INTO [TBLParameter] ([ParameterId], [ParameterDescription], [ParameterValue]) VALUES (@ParameterId, @ParameterDescription, @ParameterValue)", GxErrorMask.GX_NOMASK,prmP000B3)
             ,new CursorDef("P000B4", "INSERT INTO [TBLParameter] ([ParameterId], [ParameterDescription], [ParameterValue]) VALUES (@ParameterId, @ParameterDescription, @ParameterValue)", GxErrorMask.GX_NOMASK,prmP000B4)
             ,new CursorDef("P000B5", "INSERT INTO [TBLParameter] ([ParameterId], [ParameterDescription], [ParameterValue]) VALUES (@ParameterId, @ParameterDescription, @ParameterValue)", GxErrorMask.GX_NOMASK,prmP000B5)
          };
       }
    }

    public void getResults( int cursor ,
                            IFieldGetter rslt ,
                            Object[] buf )
    {
       switch ( cursor )
       {
       }
    }

    public void setParameters( int cursor ,
                               IFieldSetter stmt ,
                               Object[] parms )
    {
       switch ( cursor )
       {
             case 0 :
                stmt.SetParameter(1, (long)parms[0]);
                stmt.SetParameter(2, (String)parms[1]);
                stmt.SetParameter(3, (String)parms[2]);
                break;
             case 1 :
                stmt.SetParameter(1, (long)parms[0]);
                stmt.SetParameter(2, (String)parms[1]);
                stmt.SetParameter(3, (String)parms[2]);
                break;
             case 2 :
                stmt.SetParameter(1, (long)parms[0]);
                stmt.SetParameter(2, (String)parms[1]);
                stmt.SetParameter(3, (String)parms[2]);
                break;
             case 3 :
                stmt.SetParameter(1, (long)parms[0]);
                stmt.SetParameter(2, (String)parms[1]);
                stmt.SetParameter(3, (String)parms[2]);
                break;
       }
    }

 }

}
